﻿<?xml version="1.0"?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" assembly="Blazing.BusinessObjects" namespace="Blazing.BusinessObjects.Cms" >
	<class name="Site" table="sites" dynamic-insert="true" dynamic-update="true">

		<id name="ID" column="siteid" type="Int32">
			<generator class="native" />
		</id>
		<timestamp column="rowstamp" name="RowStamp" />

		<property name="Name" length="100" not-null="true" />
		<property name="Url" length="150" />
		<property name="IsLoginRequired" type="Boolean" />

		<many-to-one name="LoginPage" column="loginpageid" class="Blazing.BusinessObjects.Cms.Contentpage" />

		<set name="Masterpages" inverse="true">
			<key column="siteid" />
			<one-to-many class="Masterpage" />
		</set>

		<set name="Pages" inverse="true">
			<key column="siteid" />
			<one-to-many class="Contentpage" />
		</set>

		<set name="Menus" inverse="true">
			<key column="siteid" />
			<one-to-many class="Menu" />
		</set>

		<set name="Aliases" table="sitealiases">
			<key>
				<column name="siteid"/>
			</key>
			<composite-element class="SiteAlias">
				<parent name="ParentSite" />		 
				<property name="Name" length="255" not-null="true" />
				<property name="Url" length="255" not-null="true" />
			</composite-element>
		 </set>

    <set name="SiteTaxonomyTags" table="sitetaxonomytags">
      <key column="siteid"/>
      <many-to-many class="Blazing.BusinessObjects.Tagging.TaxonomyTag" column="taxonomytagid"/>
    </set>

    <set name="SiteWidgets">
      <key column="siteid"/>
      <one-to-many class="Blazing.BusinessObjects.Widgets.Widget" />
    </set>
		
	</class>
</hibernate-mapping>
